package com.hushao.aimi.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Collection;

/**
 * @description: 分类基本信息
 * @author: 胡少
 * @create: 2018-06-03 16:05
 **/
@Entity
@Data
@ApiModel("分类基本信息")
public class AimiCategory{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 父类id
     */
    @Column(nullable = false)
    private Integer parentId;

    /**
     * 类别名称
     */
    @NotNull(message = "类别名称不能为空！")
    @Column(length = 64,nullable = false)
    private String name;

    /**
     * 状态
     */
    @Column(nullable = false)
    private Boolean status=true;

    /**
     * 排序编号
     */
    @Column(length = 4)
    private Integer sortOrder;

    @CreationTimestamp
    private Timestamp createTime;

    @UpdateTimestamp
    private Timestamp updateTime;

    @Column(length = 512)
    private String comment;


    public AimiCategory(Integer parentId, @NotNull(message = "类别名称不能为空！") String name, Integer sortOrder) {
        this.parentId = parentId;
        this.name = name;
        this.sortOrder = sortOrder;
    }

    public AimiCategory(Integer id,Integer parentId, @NotNull(message = "类别名称不能为空！") String name, Boolean status, Integer sortOrder) {
        this.id=id;
        this.parentId = parentId;
        this.name = name;
        this.status = status;
        this.sortOrder = sortOrder;
    }
}
